<template>
	<view>
		<view class="content-detail">
			<parser :html="detailData"></parser>
		</view>
	</view>
</template>

<script>
	import parser from "@/components/jyf-Parser/index"
	export default{
		name:'headDetail',
		components:{
			parser
		},
		data(){
			return{
				detailData:'',
				id:''
			}
		},
		methods:{
			// 获取头条详情
			async getHeadDetail(){
				let res = await this.$fetch(this.$api.bookView,{id:this.id},'GET')
				this.detailData = res.data.content
				uni.setNavigationBarTitle({
					title:res.data.title
				})
				console.log(res);
			}
		},
		onLoad(options) {
			this.id = options.id
		},
		onShow() {
			if(this.id){
				this.getHeadDetail()
			}else{
				this.detailData = '暂无内容'
			}
		}
	}
</script>

<style>
	.content-detail{
		padding: 30rpx 30rpx;
		line-height: 60rpx;
		/* 在这里调整，整体字体大小 */
		font-size: 28rpx;
	}	
</style>
